<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta name="keywords" content="">
		<meta name="description" content="">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE10"/>
		<meta name="renderer" content="webkit|ie-comp|ie-stand">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link href="img/style.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" type="text/css" href="layui/css/layui.css" />
		<title>预约录课</title>
		<script src="js/common.js" type="text/javascript"></script>
		<script src="js/jquery.min.js" type="text/javascript"></script>
		<script src="js/main.js" type="text/javascript"></script>
		<script src="layui/layui.js" type="text/javascript"></script>
	</head>


	<body>
		<!--当前导航-->
		<div class="layui-card">
			<div class="layui-card-header layui-font-20" style="text-align:center">预约录课</div>
			<div class="layui-card-body">
				<form action="?action=save&acttype=add" method="post" name="addform" id="addform" class="layui-form">
					<input type="hidden" value="0" name="v_commend" id="v_commend" />
					<div class="layui-form-item">
						<label class="layui-form-label">视频来源：</label>
						<div class="layui-input-block">
							<select name="v_id" id="v_id">
							<?php
								$stats=array("(离线)","(正在直播)","(正在录制)");
								$id = $row['id'];
								$title = $row['title'];
								$stat = $row['stat'];

								echo "<option value='$id'";
								echo " selected = 'selected'";
								echo ">".$title.$stats[$stat]."</option>";
			        		?>
							</select>
						</div>
					</div>


					<div class="layui-form-item">
						<label class="layui-form-label">课程标题：</label>
						<div class="layui-input-block">
							<input type="text" id="v_name" name="v_name" lay-verify="required" placeholder="请输入标题"
								autocomplete="off" class="layui-input" />
						</div>


						
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">预约日期：</label>
						<div class="layui-input-block">
							<input type="text" name="v_sdate" id="v_sdate" placeholder="请选择日期" lay-key="1" size="11"
								class="layui-input" lay-verify="required" />
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">预约节次：</label>
						<div class="layui-input-block">
							<?php
								echo getClassTimeSelect();
							?>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">录像时间：</label>
						<div class="layui-input-block">
							<input type="text" class="layui-input" name="v_setime" id="v_setime" lay-verify="required" placeholder="请先选择节次，再调整录制时间。">
						</div>
					</div>
				
					
					<div class="layui-form-item">
						<label class="layui-form-label">课程分类：</label>
						<div class="layui-input-block">
							<select name="v_type" id="v_type"  lay-verify="required" lay-search>
								<option value="">请选择课程分类</option>
								<?php
								 	makeTypeOption(0," 　",0);
								?>
							</select>
						</div>
					</div>


					<div class="layui-form-item">
						<label class="layui-form-label">执　　教：</label>
						<div class="layui-input-block">
							<input size="30" name="v_actor" value="" class="layui-input" />
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">年　　级：</label>
						<div class="layui-input-block">
							<?php echo getAreaSelect("v_publisharea","请选择年级","");?>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">班　　级：</label>
						<div class="layui-input-block">
							<input name="v_director" size="10" value="" class="layui-input" />
						</div>
					</div>

					<div class="layui-form-item">
						<div class="layui-input-block">
							<input type="submit" name="Submit" lay-filter="*" value="确定提交" lay-submit="" class="layui-btn"/>
							<input type="reset" name="reset" value="清除重置" class="layui-btn layui-btn-primary" />
						</div>
					</div>
				</form>
			</div>
		</div>

		<script>


			layui.use(['layer','jquery','laydate','form'], function() {
				var laydate = layui.laydate;
				var sd = laydate.render({
					elem: '#v_sdate',
					value: '<?= $v_sdate ?>',
					done: function(value, date) {
						date.month = date.month - 1;
						ed.config.min = date;
					}
				});

				//时间范围
				laydate.render({
					elem: '#v_setime'
					,type: 'time'
					,range: true
				});


				form.on('select(v_classtime)', function (data) {
					text = $("#v_classtime").find("option:selected").val();
                    $("#v_setime").val(text)
				});

			});

			form = layui.form;
			$ = layui.jquery;
			layer = layui.layer;


			form.on('submit(*)', function(data){
				text = $("#v_id").find("option:selected").text();
				pos = text.indexOf("(离线)");
				if(pos>0){
					vname = text.substring(0,pos);
	
					layer.confirm(vname +"：<font color=red>离线中</font>，开始录课前必须开启该视频流设备，<br>否则会导致录像失败！", {
					btn: ['确定'], //按钮
					title:'警告',
					icon: 0
					}, function(){
						$("#addform").submit();
					
					}, function(){
					
					});
					return false; //阻止表单跳转。
				}	
			});

		</script>
	</body>

</html>
